import { useState, useRef } from "react";

export default function App() {
  // 状态数据
  const [count, setCount] = useState(0);

  // 普通数据 -> 重新渲染会重新生成数据。数据不变
  // const person = { age: 10 };

  const person = useRef({ age: 10 });

  const handleClick = () => {
    console.log(person.current);
    setCount(count + 1);
    person.current.age++;
  };

  return (
    <div>
      App
      {count}
      <button onClick={handleClick}>按钮</button>
    </div>
  );
}
